package com.yy.pojo;


public class Person {
    private String name;

    public Person(){
        System.out.println("=============person构造函数被实例化==================");
    }

    public Person(String name) {
        this.name = name;
    }

//    private static Person person;
//
//    public static Person getPerson(){
//       if(person==null){
//           person=new Person();
//       }
//       return person;
//    }
private static Person person=new Person();

    public static Person getPerson(){

        return person;
    }
    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    public String toString() {
        return "Person{name = " + name + "}";
    }
}
